package com.gimi.cloud.bbp.dao.dao.mall;

import java.util.List;

import org.apache.ibatis.annotations.Select;

import com.gimi.cloud.bbp.dao.dao.sys.BaseDao;
import com.gimi.cloud.bbp.dao.myMapper.MyMapper;
import com.gimi.cloud.bbp.dto.mall.MallAppSpecialDTO;
import com.gimi.cloud.bbp.entity.mall.MallAppSpecialEntity;

/**
 * 专场信息dao
 * @author chendi
 * @date 2018年1月31日
 */
public interface MallAppSpecialDao extends MyMapper<MallAppSpecialEntity>,BaseDao<MallAppSpecialEntity,MallAppSpecialDTO> {
	
	@Select("SELECT mas.*, ec.prod_price, ec.prod_min_price, ec.prod_max_price FROM mall_app_special mas LEFT JOIN "
			+ " ec_product ec ON ec.prod_id = mas.asl_target_id"
			+ " WHERE mas.asl_status = 1 AND mas.is_delete = 0 AND mas.asg_id = #{asgId} ORDER BY mas.asl_sort ASC LIMIT 3")
	List<MallAppSpecialDTO> getDTOByAsgIdLiMit3(Integer asgId);
	
	@Select("SELECT mas.*, ec.prod_price, ec.prod_min_price, ec.prod_max_price FROM mall_app_special mas LEFT JOIN "
			+ " ec_product ec ON ec.prod_id = mas.asl_target_id"
			+ " WHERE mas.asl_status = 1 AND mas.is_delete = 0 AND mas.asg_id = #{asgId} ORDER BY mas.asl_sort ASC")
	List<MallAppSpecialDTO> getDTOByAsgId(Integer asgId);
	
}
